using AdmissionQA.Application.Common;
using AdmissionQA.Application.Dtos.AdmissionPolicy;
using AdmissionQA.Domain.Entities;

namespace AdmissionQA.Application.ServiceInterfaces;

/// <summary>
/// 招生政策服务接口
/// </summary>
public interface IAdmissionPolicyServices
{
    /// <summary>
    /// 创建招生政策
    /// </summary>
    /// <param name="admissionPolicyName">政策名称</param>
    /// <param name="admissionPolicyContent">政策内容</param>
    /// <returns>创建结果</returns>
    Task<Result<string>> CreateAdmissionPolicyAsync(AdmissionPolicyDto admissionPolicy);

    /// <summary>
    /// 批量创建招生政策
    /// </summary>
    /// <param name="admissionPolicies">招生政策列表</param>
    /// <returns>创建结果</returns>
    Task<Result<string>> CreateAdmissionPoliciesAsync(AdmissionPolicysDto admissionPolicies);

    /// <summary>
    /// 根据ID获取招生政策
    /// </summary>
    /// <param name="id">政策ID</param>
    /// <returns>招生政策</returns>
    Task<Result<AdmissionPolicy>> GetAdmissionPolicyByIdAsync(Guid id);

    /// <summary>
    /// 获取所有招生政策
    /// </summary>
    /// <returns>招生政策列表</returns>
    Task<Result<IEnumerable<AdmissionPolicy>>> GetAllAdmissionPoliciesAsync();

    /// <summary>
    /// 分页获取招生政策
    /// </summary>
    /// <param name="pageIndex">页码</param>
    /// <param name="pageSize">页大小</param>
    /// <returns>分页结果</returns>
    Task<Result<IEnumerable<AdmissionPolicy>>> GetPagedAdmissionPoliciesAsync(
        int pageIndex = 0,
        int pageSize = 10
    );

    /// <summary>
    /// 根据名称搜索招生政策
    /// </summary>
    /// <param name="policyName">政策名称</param>
    /// <returns>匹配的政策列表</returns>
    Task<Result<IEnumerable<AdmissionPolicy>>> SearchAdmissionPoliciesByNameAsync(
        string policyName
    );

    /// <summary>
    /// 更新招生政策
    /// </summary>
    /// <param name="id">政策ID</param>
    /// <param name="admissionPolicy">招生政策</param>
    /// <returns>更新结果</returns>
    Task<Result<string>> UpdateAdmissionPolicyAsync(Guid id, AdmissionPolicyDto admissionPolicy);

    /// <summary>
    /// 删除招生政策
    /// </summary>
    /// <param name="id">政策ID</param>
    /// <returns>删除结果</returns>
    Task<Result<string>> DeleteAdmissionPolicyAsync(Guid id);

    /// <summary>
    /// 批量删除招生政策
    /// </summary>
    /// <param name="ids">政策ID列表</param>
    /// <returns>删除结果</returns>
    Task<Result<string>> DeleteAdmissionPoliciesAsync(IEnumerable<Guid> ids);

    /// <summary>
    /// 获取招生政策总数
    /// </summary>
    /// <returns>政策总数</returns>
    Task<int> GetAdmissionPolicyCountAsync();

    /// <summary>
    /// 基于向量相似度搜索招生政策
    /// </summary>
    /// <param name="text">查询文本</param>
    /// <param name="topK">返回最相似的前K个</param>
    /// <returns>最相似的招生政策列表</returns>
    Task<Result<IEnumerable<AdmissionPolicy>>> SearchAdmissionPoliciesByEmbeddingAsync(string text, int topK = 5);
}
